import java.util.ArrayList;
import java.util.Scanner;
import java.util.Stack;

public class Test {
    public static void main1(String[] args) {
        ArrayList<Integer> list = new ArrayList<>(20);
    }

    //判断子序列
    public boolean isSubsequence (String S, String T) {
        // write code here
        int i = 0;
        int j = 0;
        while (i < S.length() && j < T.length()) {
            if (S.charAt(i) == T.charAt(j)) {
                i++;
                j++;
            }else {
                j++;
            }
        }
        return i == S.length();
    }

    //点击消除
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextLine()) { // 注意 while 处理多个 case
            String str = in.nextLine();
            Stack<Character> stack = new Stack<>();

            for (int i = 0; i < str.length(); i++) {
                if (stack.empty() || str.charAt(i) != stack.peek()) {
                    stack.push(str.charAt(i));
                } else {
                    if (str.charAt(i) == stack.peek()) {
                        stack.pop();
                    }
                }
            }

            if (stack.empty()) {
                System.out.print("0");
            } else {
                Stack<Character> stack2 = new Stack<>();
                while (!stack.empty()) {
                    stack2.push(stack.pop());
                }
                while(!stack2.empty()){
                    System.out.print(stack2.pop());
                }
            }
        }
    }
}
